package com.zzxz.practicaltrainingsys.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

public class Message {
    private String from;
    private String content;
    private String time;
    private String type;
    private UserInfo userInfo;

    // 构造函数
    public Message() {}

    public Message(String from, String content, String time, String type) {
        this.from = from;
        this.content = content;
        this.time = time;
        this.type = type;
    }

    // Getter 和 Setter 方法
    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }

    // 用户信息内部类
    public static class UserInfo {
        private String realName;
        private String type;

        public UserInfo() {}

        public UserInfo(String realName, String type) {
            this.realName = realName;
            this.type = type;
        }

        public String getRealName() {
            return realName;
        }

        public void setRealName(String realName) {
            this.realName = realName;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }
    }

    @Override
    public String toString() {
        return "Message{" +
                "from='" + from + '\'' +
                ", content='" + content + '\'' +
                ", time='" + time + '\'' +
                ", type='" + type + '\'' +
                ", userInfo=" + userInfo +
                '}';
    }
}